<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%>
<%@ taglib uri="http://struts.apache.org/tags-html" prefix="html"%>
<%@ taglib uri="http://struts.apache.org/tags-logic" prefix="logic"%>
<%@ taglib uri="http://struts.apache.org/tags-tiles" prefix="tiles"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="css/style.css" rel="stylesheet" type="text/css">
<link type="text/css" href="jquery/jquery-ui-1.8.19.custom.css" rel="stylesheet" />
<script type="text/javascript" src="jquery/jquery.min.js"></script>
<script type="text/javascript" src="jquery/jquery-ui-1.8.19.custom.min.js"></script>
<script type="text/javascript" src="script/commons.js"></script>
<script type="text/javascript" src="script/objects.js"></script>
<style type="text/css">
#searchTitle {
	position: relative;
	top: -1px;
	left: 45px;
	font-size: 13px;
}

#searchKey {
	padding-left: 45px;
	width: 150px;
}

.aButton {
	padding-right: 5px;
}

.customerId {
	width: 5%
}

.customer {
	width: 30%
}

.customerRemark {
	width: 45%
}

.buttons {
	width: 20%
}
</style>
<script type="text/javascript">
var currentMode = '${mode}';
pager.currentPage = "${page.currentPage}";
pager.action = "disCustomer.do";
pager.getParam = function() {
	if (currentMode == "s") {
		return "&key=" + $("#searchKey").val();
	}
	return "";
}

function doSearch() {
	to("disCustomer.do?key=" + $("#searchKey").val());
}
var lastTr;
function doEnable(v) {
	lastTr = findParent(event.srcElement, "TR");
	$.post("disCustomer.do", { id : v },
		function() {
			with (lastTr) {
				childNodes[3].innerHTML = "";
				var bcolor = "#CCCCCC";
				var fcolor = "#EFEFEF";
				childNodes[0].style.color = fcolor;
				childNodes[1].style.color = fcolor;
				childNodes[2].style.color = fcolor;
				childNodes[3].style.color = fcolor;
				childNodes[0].style.backgroundColor = bcolor;
				childNodes[1].style.backgroundColor = bcolor;
				childNodes[2].style.backgroundColor = bcolor;
				childNodes[3].style.backgroundColor = bcolor;
			}
		}
	);
}
$(document).ready(function() {
	$("#searchKey").val('${key}');
});
</script>
</head>

<body>
	<form action="customerallinfo.do" method="post">
		<div class="button_bar">
			<label><span id="searchTitle">客户名:</span><input
				id="searchKey" name="searchKey" type="text" /> </label>
			<button class="common_button" onclick="doSearch()">
				查询 <img alt="新增" src="images/mainButton/search1.gif" width="10px;">
			</button>
		</div>
		<table width="770" height="133" class="data_list_table">
			<tr>
				<th>客户编号</th>
				<th>客户名称</th>
				<th>备注信息</th>
				<th>执行操作</th>
			</tr>
        <c:if test="${customers!=null}">
        <c:forEach var="item" items="${customers}" varStatus="i">
        <c:choose>
            <c:when test="${i.index % 2 == 0}">
            <tr class="row1">
            </c:when>
            <c:otherwise>
            <tr class="row2">
            </c:otherwise>
        </c:choose>
                <td class="list_data_number customerId">${item.customerid}</td>
                <td class="list_data_text customer">${item.customer}
                <c:if test="${item.shopCount > 0}">(渠道)</c:if>
                </td>
                <td class="list_data_text customerRemark">${item.customerremark}</td>
                <td class="list_data_text buttons">
                <a href="javascript:void()" class="aButton" onclick="doEnable('${item.customerid}')">
                启用</a></td>
            </tr>
            <!--隐藏域 显示详细信息  -->
        </c:forEach>
		</c:if>
            <tr>
				<th colspan="9" class="pager">
                    <a href="javascript:void()" onclick="pager.first()">
                    <img alt="第一页" src="images/mainButton/pagefirst.gif" width="10px;" border="0px;">
                    </a>
                    <a href="javascript:void()" onclick="pager.previous()">
                    <img alt="上一页" src="images/mainButton/pageprev.gif" width="60px;"
                        border="0px;">
                    </a>
                    <a href="javascript:void()" onclick="pager.next()">
                    <img alt="下一页" src="images/mainButton/pagenext.gif" width="60px;"
                        border="0px;">
                    </a>
                    <a href="javascript:void()" onclick="pager.last()">
                    <img alt="最后一页" src="images/mainButton/pageafter.gif" width="10px;"
                        border="0px;">
                    </a>
                    共${page.totalRows}条记录 每页 ${page.pageSize} 条 第 ${page.currentPage}
                    页/共${page.totalPages}页
					&nbsp;&nbsp;&nbsp;&nbsp;
				</th>
			</tr>
		</table>
	</form>

</body>
</html>
